﻿@model IList<SYH.Public.Model.PublicAlbumImg>
@{
    Layout = null;
}
<!DOCTYPE html>

<html>
<head>
    <title>相册</title>
    <link href="@Url.Content("~/Areas/User/Css/all2.css")" rel="stylesheet" type="text/css" />
    <link href="/JS/artDialog/skins/Dialog.css" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Areas/User/Css/shop.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/JS/jquery.min.js")" type="text/javascript"></script>
</head>
<body>
<!--右侧开始-->
    <div class="rightbar mt10">
        <ul class="tittab">
            <li class="tcurrent"><a hidefocus="" href="/User/Images/Album">管理相册</a></li>
            <li><a hidefocus="" href="/User/Images/ImgUploadBatch">上传图片</a></li>
        </ul>
        <p class="subtitle">
            <b><a href="/User/Images/Album">所有相册</a> &gt;<a href="/User/Images/AlbumInfo?id=@ViewBag.AblumnId">
                @ViewBag.AlbumName</a> &gt; <i class="orange">
                    @ViewBag.ImageTitle</i></b></p>
        <ul class="ml10 proshow mt10">
            <li>
                <p class="picimg">
                    <img src="@ViewBag.imageurl" /></p>
                <p class="mt10">
                @if (ViewBag.Set == true)
                {
                    <span id="setFontCover" class="blue reset ml10"><a href="###" onclick="setCoverFile();">
                        设置封面</a></span>
                }
                else
                { 
                     <span id="setFontCover" class="blue reset ml10" style="display:none"><a href="###" onclick="setCoverFile();">
                        设置封面</a></span>
                }
                  @if (ViewBag.Is == true)
                  {
                    <span id="isFontCover" class="cg ml10 green">已为封面</span>
                  }
                  else
                  { 
                    <span id="isFontCover" class="cg ml10 green" style="display:none">已为封面</span>
                  }
                    <span class="blue reset ml10"><a href="###" onclick="moveAlbum();">移动</a></span>
                    <span class="blue reset ml10"><a href="###" onclick="del();">删除</a></span>
                </p>
            </li>
            <li class="img_bg ml10">
                <table width="420" height="189" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <td height="26" colspan="3">
                            <b class="f14 blue">
                                @ViewBag.AlbumName</b> 中的其他照片
                        </td>
                    </tr>
                    <tr>
                        <td height="136" colspan="3">
                            <div id="mytest" style=" width: 310px; overflow: hidden;">
                                <ul class="proshow2">
                                         @foreach (var single in @Model)
                                         {
                                            <li><a href="/Images/AlbumImageDetail?id=@single.Id&album=@single.AlbumId">
                                                <img src="@Common.GDI.ResizeImage(single.Name.ToString(), 100)" /></a> <a href="/Images/AlbumImageDetail?album=@single.AlbumId"
                                                    title="@single.Title">
                                                    <p>
                                                       @Common.StringManager.SubByte(single.Title, 8)</p>
                                                </a></li>
                                         }
                                </ul>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td width="59" height="25" id="next">
                            <i class="left-arrow"></i><span class="blue fd-left"><a href="#">上一张</a></span>
                        </td>
                        <td width="276">
                            &nbsp;
                        </td>
                        <td width="85" id="prev">
                            <i class="right-arrow"></i><span class="blue fd-left"><a href="#">下一张</a></span>
                        </td>                        
                    </tr>
                </table>
            </li>
        </ul>
        <div class="pic_popup">
            <ul class="mt10 ml10">
                <li>图片标题：<span class="gray">（1-30个中文字或英文字母）</span></li>
                <li>
                    <input id="txtTitle" name="txtTitle" value='@ViewBag.ImageTitle' type="text" class="txt2" /></li>
                <li><span class="orange-btn"><a href="###" onclick="AddInfo();">保存</a></span></li>
            </ul>
        </div>
    </div>
  
    <script type="text/javascript">
    $(function () {            
            $("#mytest").jCarouselLite({
                btnNext: "#next",
                btnPrev: "#prev",
                visible: 3
            });
        });        
        
        function moveAlbum() {
            var option = { id: '1233' };
            jQuery.dialogHelper.open("/Shop/MoveImage.aspx?albumid=<%=AblumnId %>&image=<%=imageId %>", option);   
        }
        function move(imageid,newalbumid) {
            $.ajax({
                type: "POST",
                url: "/Images/MoveImage" ,
                data:"albumid=" ViewBag.AblumnId + "&image=" + imageid+"&ddlalumn="+newalbumid,
                cache: false,
                dataType: "text",
                error: function () {
                    jQuery.dialogHelper.alert("网络忙，请稍后再试！", "alert");
                },
                success: function (msg) {
                    if (msg != "1") {
                        jQuery.dialogHelper.alert("图片移动失败!请确定所选的图片是否存在。", "alert");
                    }
                    else {
                        jQuery.dialogHelper.alert("图片移动成功！", "success", "okmoveSuccess");    
                    }
                }
            });
        }
        function okmoveSuccess() {
            $.dialogHelper.close();
            location.href="/Images/AlbumInfo?id=@ViewBag.AblumnId";
        }
        function okSuccess() {
            $.dialogHelper.close();
            location.reload();
        }
        ///将图片相册从相册移除
        function del() {
            $.get("/Shop/ashx/AlbumHandler.ashx?action=remove&id=<%=imageId %>&alumnid=<%=AblumnId %>", function (data) {
                        jQuery.dialogHelper.alert("删除成功！", "success", "okmoveSuccess");    
            })
        }

        function setCoverFile() {
                $.get("/User/Images/AlbumOperator?image=@ViewBag.imageName&albumId=@ViewBag.AblumnId", function (data) {
                location.reload();  
                })   
        }
        function AddInfo() {
        $.ajax({
            type: "POST",
            url: "<%=Common.RequestHelper.GetRawUrl() %>",
            data: "txtTitle=" + $("#txtTitle").val(),
            cache: false,
            dataType: "text",
            error: function () {
                    jQuery.dialogHelper.alert("网络忙，请稍后再试！", "alert");
            },
            success: function (msg) {
                if (msg == "1") {
                        jQuery.dialogHelper.alert("修改成功！", "success", "okSuccess");                     
                } else {
                    jQuery.dialogHelper.alert("修改失败！", "alert");
                }
            }
        });
    }
    </script>
</body>
</html>